{extend name="apps/common/view/front.tpl" /}
<!-- -->
{block name="header_meta"}
<title>{:config('index.site_title')}－{:config('common.site_name')}</title>
<meta name="keywords" content="{:config('index.site_keywords')}" />
<meta name="description" content="{:config('index.site_description')}"  />
{/block}
{block name="header"}
<nav class="navbar navbar-expand-md navbar-dark bg-dark mb-3">
<div class="container">
  <a class="navbar-brand" href="{$path_root}">{:config('common.site_name')}</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#nav">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="nav">
    <ul class="navbar-nav ml-auto">
      {volist name=":DcNavSelect(['tree'=>true,'level'=>false,'controll'=>'navbar','sort'=>'op_order','order'=>'asc'])" id="navs" offset="0" length="99"}
      {if $navs['_child']}
        <li class="position-relative nav-item {:DcDefault($module.$controll.$action, $navs['nav_active'], 'active', '')}" id="{$navs.nav_active}">
          <a class="nav-link dropdown-toggle" href="javascript:;" data-toggle="dropdown">{$navs.nav_text|DcSubstr=0,5,false}</a>
          <div class="dropdown-menu">
            {volist name="navs._child" id="navSon"}
            <a class="dropdown-item" href="{$navSon.nav_link}" target="{$navSon.nav_target}">{$navSon.nav_text|DcSubstr=0,5,false}</a>
            {/volist}
          </div>
        </li>
      {else/}
        <li class="nav-item {:DcDefault($module.$controll.$action, $navs['nav_active'], 'active', '')}" id="{$navs.nav_active}">
          <a class="nav-link" href="{$navs.nav_link}" target="{$navs.nav_target}">{$navs.nav_text|DcSubstr=0,5,false}</a>
        </li>
      {/if}
      {/volist}
    </ul>
  </div>
</div>
</nav>
{/block}
<!--main -->
{block name="main"}
<div class="container">
  <div class="card mb-3">
    <div class="card-header">数据库字段</div>
    <pre class="card-body pb-0">{:dump( model('navs/Fields','loglic')->keys() )}</pre> 
  </div>
  <div class="card mb-3">
    <div class="card-header">添加</div>
    <pre class="card-body pb-0">{literal}
    $result = DcNavSave([
        'nav_text'        => '首页',
        'nav_type'        => 'addon',
        'nav_url'         => '',
        'nav_module'      => 'navs',
        'nav_controll'    => 'index',
        'nav_action'      => 'index',
        'nav_params'      => 'a=1',
        'nav_target'      => '_self',
        'nav_ico'         => 'fa fa-fw fa-home',
        'nav_active'      => 'navsindexindex',
        'op_module'       => 'common',
        'op_controll'     => 'navbar',
        'op_action'       => 'header',
        'op_order'        => '99',
    ]);
    dump($result);{/literal}</pre> 
  </div>
  <div class="card mb-3">
    <div class="card-header">删除</div>
    <pre class="card-body pb-0">{literal}
    $result = DcNavDelete([
        'cache'    => true,
        'id'       => 88,
    ]);
    dump($result);
    $result = DcNavDelete([
        'cache'    => true,
        'where'    => ['op_id'=>['in','88,89,90']],
    ]);
    dump($result);{/literal}</pre> 
  </div>
  <div class="card mb-3">
    <div class="card-header">修改</div>
    <pre class="card-body pb-0">{literal}
    $result = DcNavUpdate(88,[
        'nav_text'        => 'update',
        'nav_type'        => 'addon',
        'nav_url'         => '',
        'nav_module'      => 'navs',
        'nav_controll'    => 'index',
        'nav_action'      => 'index',
        'nav_params'      => 'a=1',
        'nav_target'      => '_self',
        'nav_ico'         => 'fa fa-fw fa-home',
        'nav_active'      => 'navsindexindex',
        'op_module'       => 'common',
        'op_controll'     => 'navbar',
        'op_action'       => 'header',
        'op_order'        => '88',
    ]);{/literal}</pre> 
  </div>
  <div class="card mb-3">
    <div class="card-header">查询多个</div>
    <pre class="card-body pb-0">{literal}
    $result = DcNavSelect([
        'cache'    => true,
        'tree'     => true,
        'level'    => false,
        'sort'     => 'op_order',
        'order'    => 'asc',
        'status'   => 'normal',
        'controll' => 'navbar',
    ]);
    dump($result);{/literal}</pre> 
  </div>
  <div class="card mb-3">
    <div class="card-header">查询单个</div>
    <pre class="card-body pb-0">{literal}
    $result = DcNavFind([
        'cache'    => true,
        'id'       => 88,
    ]);
    dump($result);{/literal}</pre> 
  </div>
  <p class="text-center">
    Powered by <a class="text-muted small" href="http://www.daicuo.net" target="_blank">{:lang('appName')} V {:config('daicuo.version')}</a>
  </p>
  <p class="text-center">
    Copyright © 2019-2021 {:config('common.site_domain')} All rights reserved
  </p>
</div>
{/block}
<!-- -->